import type { IArticle, IArticleCategory, IArticleDetail } from "@/types/content/articleType";
import type { IList, IResponse } from "@/types/utils";
import { myRequest } from "..";

// 查询文章列表
function queryArticleList(payload: {
  limit: number;
  offset: number;

  categoryId?: string;
}) {
  return myRequest.get<IResponse<IArticle[]>>({
    url: "/article_list_mobile/query",
    params: payload,
  });
}

// 获取指定文章详情
function getArticleDetail(id: string) {
  return myRequest.get<IResponse<IArticleDetail>>({
    url: `/article/${id}`,
  });
}

// 获取文章分类
function getArticleCategory() {
  return myRequest.get<IResponse<IList<IArticleCategory[]>>>({
    url: "/article_category/list",
  });
}
export { queryArticleList, getArticleDetail, getArticleCategory };
